<%-- 
    Document   : modifiedProfile
    Created on : 7-apr-2013, 17.22.25
    Author     : Giuseppe
--%>
<%@page import="ejb.ArticoloUsato"%>
<%@page import="java.util.LinkedList"%>
<%@page import="ejb.ArticoloNuovo"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="wrapper.jsp" %>
<%
    Utente utSession = (Utente) session.getAttribute("utente");
    String tipo = utSession.getTipo();
    Integer totCarrello = 0;
    LinkedList<ArticoloNuovo> carrello = (LinkedList<ArticoloNuovo>) session.getAttribute("carrello");
    List<ArticoloUsato> usatiDaConfermare = (List<ArticoloUsato>) session.getAttribute("usatiDaConfermare");

%>
<div class="container">
    <div class="row-fluid">
        <div class="span3 bs-docs-sidebar"></div>

        <div class="span6">   
            <h3>Modifica Profilo</h3>

            <form class="form-horizontal" action="Controller" method="POST" onSubmit="return checkProfile(this)">
                <div class="control-group">
                    <label class="control-label" for="inputNome">Nome:</label>
                    <div class="controls">
                        <input name="nome" type="text" id="inputNome" placeholder="Nome" value="<%=utente.getNome()%>">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputCognome">Cognome:</label>
                    <div class="controls">
                        <input name="cognome" type="text" id="inputCognome" placeholder="Cognome" value="<%=utente.getCognome()%>">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputPassword">Vecchia Password:</label>
                    <div class="controls">
                        <input name="oldpwd" type="password" id="inputPassword" placeholder="Password">
                    </div>
                </div>     
                <div class="control-group">
                    <label class="control-label" for="inputPassword2">Nuova Password:</label>
                    <div class="controls">
                        <input type="password" name="pwd" id="inputPassword2" placeholder="Password">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputPassword2">Conferma Password:</label>
                    <div class="controls">
                        <input type="password" name="confermapwd" id="inputPassword2" placeholder="Conferma Password">
                    </div>
                </div> 
                <div class="control-group">
                    <label class="control-label" for="inputEmail">Email:</label>
                    <div class="controls">
                        <input name="eMail" type="text" id="inputEmail" placeholder="Email" value="<%=utente.geteMail()%>">
                    </div>
                </div>
                <label id="erroreDati" style="padding-left: 100px;color: red;"></label>
                <div class="control-group">
                    <label class="control-label" style="padding-left: 100px"><button  class="btn btn-small btn-inverse btn success" type="submit" value="modificaProfilo" name="button"><i class="icon-white icon-ok"></i> Modifica</button></label>
                </div>
            </form>
        </div>
        <div class="span3">
            <%
                if (tipo.equals("u")) {
            %>
            <div class="thumbnail">
                <p><b>Carrello</b></p>
                <table>
                    <tr><td></td><td style="padding-left: 5px"><b>Articolo</b></td><td style="padding-left: 5px"><b>Costo</b></td></tr>
                    <tr><td><br></td><td><br></td><td><br></td></tr>
                            <%
                                for (ArticoloNuovo a : carrello) {
                                    totCarrello = totCarrello + a.getPrezzo();
                            %>
                    <tr>
                    <p>
                    <td>
                        <a href="Controller?button=removeCarrello&amp;idArticolo=<%=a.getId()%>">
                            <button class="btn btn-inverse btn-mini"><i class="icon-white icon-trash"></i></button>
                        </a>
                    </td>
                    <td style="padding-left: 5px;height: 20px;width:100%;overflow:hidden;float:left"><%=a.getNome()%></td>
                    <td style="padding-left: 5px"><%=a.getPrezzo().toString()%> €</td>
                    </p>
                    </tr>
                    <tr><td><br></td><td><br></td><td><br></td></tr>
                            <%}%>
                    <tr><td></td><td><b>Totale</b></td><td style="padding-left: 5px"><%=totCarrello.toString()%> €</td></tr>
                </table>
            </div>

            <%} else if (tipo.equals("a")) {%>
            <div class="thumbnail">
                <p><b>Notes</b></p>
                <br>
                <% if (!usatiDaConfermare.isEmpty()) {%>
                <p> Ancora <%=usatiDaConfermare.size()%> articoli da confermare </p>
                <br>
                <p align="center">
                    <a href="Controller?button=modificaCancellaArtUsati&amp;confirm=s">
                        <button class="btn btn-inverse btn-small"><i class="icon-white icon-th-list"></i> Vedi Articoli da confermare</button>
                    </a>
                </p>
                <%} else {%>
                <p> Nessun articolo da confermare </p>
                <%}%>      
            </div>
            <%}%>
        </div>          

    </div>
</div>
</body>


</html>

